<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>项目申报</title> 
[#include "../common.html"/]
<script type='text/javascript' src='${base}/fckeditor/fckeditor.js'></script>
<script src="${base}/front/resource/swfupload/swfupload.js" type="text/javascript"></script>
<script src="${base}/front/resource/swfupload/swfupload.queue.js" type="text/javascript"></script>
<script src="${base}/front/resource/swfupload/fileprogress.js" type="text/javascript"></script>
<script src="${base}/front/resource/swfupload/handlers.js" type="text/javascript"></script>
<link href="${base}/front/resource/swfupload/process.css" rel="stylesheet" type="text/css"/>

<script type="text/javascript">
$(function() {
	$("#jvForm").validate();
	scrollx({id:'tempsave',t:200,f:0});
	
	swfau = new SWFUpload({
		upload_url : "${base}/swfAttachsUpload.jspx",
		flash_url : "${base}/front/resource/swfupload/swfupload.swf",
		file_size_limit : "1 MB",//每个大小
		file_upload_limit : 5,//个数
		file_types : "",
		file_types_description : "File Types",
		file_queue_limit : 0,
		custom_settings : {
			progressTarget : "afsUploadProgress",
			cancelButtonId : "abtnCancel"
		},
		debug: false,
		
		button_image_url : "${base}/front/resource/swfupload/button_notext.png",
		button_placeholder_id : "aspanButtonPlaceHolder",
		button_text: "<span class='btnText'>上传附件</span>",
		button_width: 84,
		button_height: 24,
		button_text_top_padding: 2,
		button_text_left_padding: 20,
		button_text_style: '.btnText{color:#666666;}',
		
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadAttachSuccess,
		upload_complete_handler : uploadComplete,
		queue_complete_handler : queueComplete
	});
});

function uploadAttachSuccess(file,data) {
	var jsonData = eval("("+data+")");//转换为json对象 
	addAttachLine();
	var index = attachIndex - 1;
	var attachUrl = jsonData.file;
	$("#attachmentName"+index).text(attachUrl.split("|")[0]);
	$("#attachUrl"+index).val(attachUrl);
	var progress = new FileProgress(file, this.customSettings.progressTarget);
	progress.setComplete();
	progress.setStatus("上传成功");
	progress.toggleCancel(false);
}

function deltablerow(trId){
	$("#" + trId).remove();
}
</script>
</head>

<body>
	<div class="wrap">
		[#include "../header.html"/]
		<form id="jvForm" action="${base}/main/project_save.jspx" method="post">
			<table class="inputtable" border="1" bordercolor="#808080">
				<tr>
					<th>附件</th>
					<td colspan="3">
						<span id="aspanButtonPlaceHolder"></span>
						<span><input style="display:none;" id="abtnCancel" type="button" value="取消上传" onclick="swfau.cancelQueue();"/></span>
						
						<textarea id="attachTr" style="display:none">
							<tr id="attachTr{0}">
								<td align="left">
									<span id="attachmentName{0}"></span>
									<input type="hidden" id="attachUrl{0}" name="attachUrl"/>
								</td>
								<td align="center" width="60">
									<a onclick="if(confirm('您确定要删除吗？')){$('#attachTr{0}').remove();}" href="javascript:void(0);">删除</a>
								</td>
							</tr>
						</textarea>
						<script type="text/javascript">
						var attachIndex = 1;
						var attachTpl = $.format($("#attachTr").val());
						function addAttachLine() {
							$('#attachTable').append(attachTpl(attachIndex++));
						}
						</script>
						
						<table id="attachTable" border="0"></table>
						<div id="afsUploadProgress"></div>
					</td>
				</tr>
				<tr>
					<th>项目名称</th>
					<td><input type="text" class="required" name="projectName" /></td>
					<th>项目类别</th>
					<td>
					<select class="required" name="projectType.primaryKey">
						<option></option>
						[@library_list code='18']
						[#list tag_list as lib]
						<option value="${lib.primaryKey}">${lib.libraryInfoName!}</option> 
						[/#list]
						[/@library_list]
					</select> 
				</tr>
				<tr>
					<th>预算总额</th>
					<td>
						<input type="text" class="required number" name="budgetTotal" /></td>
					</td>
					<th>是否高企</th>
					<td>
						<input type="radio" name="isHighTec" value="1" class="required" />是
						<input type="radio" name="isHighTec" value="2" class="required" />否
					</td>
				</tr>
				<tr>
					<th>整数</th>
					<td colspan="3"><input type="text" class="required digits" name="" value="1"/></td>
				</tr>

				<tr>
					<th>邮箱</th>
					<td><input type="text" class="required email" name="" value="123@123.com" /></td>
					<th>手机号</th>
					<td><input type="text" class="required ismobile" name="" maxlength="11" value="11111111111" /></td>
				</tr>
				<tr>
					<th>项目计划</th>
					<td colspan="3">
					[@library_list code='18']
					[#list tag_list as lib]
					<input type="checkbox" name="projectPlan" value="${lib.primaryKey}" class="required" />${lib.libraryInfoName!} 
					[/#list]
					[/@library_list]
					</td>
				</tr>
				<tr>
					<th><em>*</em>&nbsp;&nbsp;项目开始日期</th>
					<td><input type="text" class="Wdate required" readonly="readonly" name="projectBegin" onClick="WdatePicker()" /></td>
					<th><em>*</em>&nbsp;&nbsp;项目结束日期</th>
					<td><input type="text" class="Wdate required" readonly="readonly" name="projectEnd" onClick="WdatePicker()" /></td>
				</tr>

				<tr>
					<th>介绍一</th>
					<td colspan="3">
						<textarea name="introOne"></textarea>
						<script type="text/javascript">
						var fckone = new FCKeditor("introOne","${base}","",200,"Image");
						fckone.ReplaceTextarea(); 
						</script>
					</td>
				</tr>

				<tr>
					<th>介绍二</th>
					<td colspan="3">
						<textarea name="introTwo"></textarea>
						<script type="text/javascript">
						var fcktwo = new FCKeditor("introTwo","${base}","",300);
						fcktwo.ReplaceTextarea();
						</script>
					</td>
				</tr>

				<tr>
					<th>项目负责人（<a href="javascript:void(0)" onclick="addManagerRow()">新增一行</a>）</th>
					<td colspan="3">
					
					<textarea style="display:none" id="managerTpl">
						<tr id="managerTr-{0}">
							<td>
								<input type='text' name='managerName' style='width:50px;'></input>
							</td>
							<td>
								<select name="managerSex" style='width:50px;'>
	    							<option value='1'>男</option>
	    							<option value='2'>女</option>
	    						</select>
							</td>
							<td>
								<input type='text' name='managerAge' style='width:50px;'></input>
							</td>
							<td>
								<select name="managerDegree" style='width:50px;'>
								[@library_list code='21']
								[#list tag_list as degree]
	    						<option value='${degree.primaryKey}'>${degree.libraryInfoName!}</option>
	    						[/#list]
	    						[/@library_list]
	    						</select>
							</td>
							<td align="center">
								<img style='cursor:pointer' title='删除' src='${base}/images/grid_images/rowdel.png' border='0' onclick="deltablerow('managerTr-{0}')" />
							</td>
						</tr>
					</textarea> 
					
					<script type="text/javascript">
					var managerIndex = 1;
					var managerTpl = $.format($("#managerTpl").val());
					function addManagerRow() {
						$('#managerTable').append(managerTpl(managerIndex++));
					}
					</script>

					<table cellSpacing='0' cellPadding='2' width='100%' border='1' id='managerTable'>
						<tr>
							<td style="text-align: center;">姓名</td>
							<td style="text-align: center;">性别</td>
							<td style="text-align: center;">年龄</td>
							<td style="text-align: center;">学历</td>
							<td style="text-align: center;width:40px;">操作</td>
						</tr>
					</table>
					</td>
				</tr>
				
			
				<tr>
					<th></th>
					<td colspan="3">
					
					<input type="submit" value="保存" />
					
					<div id="tempsave"  style="display:block;">
						<input type="submit" class="button" value="" />
						<font color="blue">填写过程中请多使用临时保存按钮，及时保存您填写的数据。</font><br/>
						<font color="red">有问题请联系浏览器底部技术人员电话。</font>
					</div>
					
					</td>
				</tr>
			</table>
		</form>

		[#include "../footer.html"/]
	</div>
</body>
</html>